﻿// Extensions Made Easy - Copyright 2012 by Jan Van der Haegen - All rights reserved, use for educational purposes only.

using System.ComponentModel.Composition;
using Microsoft.LightSwitch.Theming;

namespace ExtensionsMadeEasy.ClientAPI.Theme
{
    [InheritedExport(typeof(IThemeExtensionExporter))]
    public abstract class EasyThemeWithExtensionsExporter <T, TE> : EasyThemeExporter<T>, IThemeExtensionExporter
        where T : ITheme, new() where TE : IThemeExtension, new()
    {
        private TE themeExtension;

        public IThemeExtension GetThemeExtension()
        {
            return this.themeExtension == null ? (this.themeExtension = new TE()) : this.themeExtension;
        }
    }
}